
#include <stdio.h>

struct person
{
    char *name;
    int age;
    char score;
    int id;
};

/**
 * 将所有传入的参数全部打印出来
*/
int push_test(const char *format, ...)
{
    char *p = (char *)&format;

    printf("arg1 = %s\n", format);

    p += sizeof(char *);
    printf("arg2 = %d\n", *((int *)p));

    p += sizeof(int);
    struct person per = *((struct person *)p);
    printf("arg3 = [.name:%s .age:%d .score:%c .id:%d]\n",
           per.name, per.age, per.score, per.id);

    p += sizeof(struct person);
    printf("arg4 = %c\n", *((char *)p));

    /**
     * 1、 4字节对齐   也可以写成    p += (szieof(char) + 3 & ~3)
     * 2、 函数参数浮点型在堆栈中为 double
    */
    p += sizeof(char) + 3; 
    printf("arg5 = %lf\n", *((double *)p));


    return 0;
}

int main()
{

    struct person per = {"www.100ask.org", 10, 'A', 123};

    push_test("abcd", 123, per, 'c', 2.79);

    return 0;
}